package com.rockcent.api;

import com.rockcent.common.common.RWebMvcConfigurerAdapter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;

/**
 * Created by zhangjh on 2017/1/13.
 */
@Configuration
@EnableWebMvc
public class WebMvcConfig extends RWebMvcConfigurerAdapter {

    @Autowired
    private AuthInterceptor authInterceptor;

    @Autowired
    private AuthUserInterceptor authUserInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        super.addInterceptors(registry);
        registry.addInterceptor(authInterceptor)
                .excludePathPatterns("/monitor/telnet/info")
                .excludePathPatterns("/v1/sso/user/login")
                .excludePathPatterns("/v1/sso/user/token")
                .excludePathPatterns("/v1/wechat/notify")
                .excludePathPatterns("/v1/sso/site_user_feedback/save");

        registry.addInterceptor(authUserInterceptor)
                .excludePathPatterns("/monitor/telnet/info")
                .excludePathPatterns("/v1/sso/user/login")
                .excludePathPatterns("/v1/sso/user/token")
//                .excludePathPatterns("/v1/mall/member/info")
//                .excludePathPatterns("/v1/mall/member/fund/flow/page")
//                .excludePathPatterns("/v1/mall/member/fund/flow/page/export")
//                .excludePathPatterns("/v1/mall/member/recharge/page")
//                .excludePathPatterns("/v1/mall/member/recharge/save")
//                .excludePathPatterns("/v1/mall/member/all/fund/flow/page")
                .excludePathPatterns("/v1/wechat/notify")
//                .excludePathPatterns("/v1/merchant/mall/financial/settings/info")
//                .excludePathPatterns("/v1/wechat/recharge")
//                .excludePathPatterns("/v1/wechat/recharge/query")
//                .excludePathPatterns("/v1/wechat/qrcode")
//                .excludePathPatterns("/v1/merchant/recharge/page")
//                .excludePathPatterns("/v1/merchant/recharge/save")
//                .excludePathPatterns("/v1/sso/merchant_user_feedback/save")
//                .excludePathPatterns("/v1/sso/mall_user_feedback/save")
                .excludePathPatterns("/v1/sso/site_user_feedback/save");
//                .excludePathPatterns("/v1/merchant/bankcard/send_code")
//                .excludePathPatterns("/v1/merchant/bankcard/check_code");
    }

}
